//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using EntLibContrib.Resource;
using EntLibContrib.Resource.Configuration;
using EntLibContrib.Resource.Providers;
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
#endif


namespace EntLibContrib.Resource.Tests
{
	[TestClass]
	public class InternalResourceProviderCustomFactoryFixture
	{
		[TestMethod]
		public void CheckResourceProviderCustomFactoryInstanceTest ()
		{
			Assert.IsNotNull(TestResourceProviderCustomFactory.Instance);
		}

		[TestMethod]
		public void GetResourceProviderDataTest ()
		{
			TestResourceProviderCustomFactory testResourceProviderCustomFactory = new TestResourceProviderCustomFactory();
			ResourceProviderData resourceProviderData = testResourceProviderCustomFactory.GetConfigurationData("InternalResourceProvider", new InternalResourceConfigurationSource());
			Assert.IsNotNull(resourceProviderData);
			Assert.AreEqual("InternalResourceProvider", resourceProviderData.Name);
			Assert.AreEqual("EntLibContrib.Resource.Store.Properties.InternalResources", resourceProviderData.ResourceBaseName);
			Assert.AreSame(typeof(AssemblyResourceProvider), resourceProviderData.Type);
		}
	}

	internal class TestResourceProviderCustomFactory : ResourceProviderCustomFactory
	{
		public TestResourceProviderCustomFactory ()
		{
		}

		public ResourceProviderData GetConfigurationData (string name, IConfigurationSource configurationSource)
		{
			return base.GetConfiguration(name, configurationSource);
		}
	}
}